<?php
namespace Model;
use Think\Model;

/**
 * Created by PhpStorm.
 * User: Yujie
 * Date: 2018/9/1
 * Time: 00:23
 */
class BaseModel extends Model{
    protected static $_db;
    public $_table;
    public  function __construct(){
        $this->_db = M($this->_table);
    }

    public function findOne($w,$f){
        $ret = $this->_db->where($w)->field($f)->find();
        return $ret;
    }
    public static function setTable($table){
        self::$_db = M($table);
        return self();
    }
    public function selectAll($w,$f){
        $ret = $this->_db->where($w)->field($f)->select();
        return $ret;
    }
}